Dynomotion

Group: DynoMotion Message: 3409 From: quelisto Date: 1/24/2012
Subject: Halls for bldc feedback
Tom: I presume it is possible to use Hall effect sensors for feedback. How can this be implemented in the software? The Halls on a motor I am using are TTL level signals, basically they are open collector with a pull-up resistor to 5V that I add on (for now they're 1.5 K).

Thanks.
Group: DynoMotion Message: 3418 From: Tom Kerekes Date: 1/25/2012
Subject: Re: Halls for bldc feedback
Hi Erik,
 
Hall sensors are sometimes used for brushless commutation not position feedback.  But the preferred method is to use the encoder position (with an index pulse) to do sinusoidal commutation.  This involves fewer IO bits, less wiring, and smoother commutation with less torque ripple. 
 
There is a C program to analyze your brushless motor characteristics automatically.  You only need to wire up the encoder and an index pulse and the 3 motor phases (to Out0, Out1, Out2 for side A of SnapAmp, or Out4, Out5, Out6 for side B).  The program is called AutoPhaseFind.c.  You will need to change some defines for your situation (which axis, which encoder, which index pulse input, which SnapAmp, etc...)  Running the program will rotate the motor like a stepper motor by energizing the various phases while watching the encoder and the index pulse.  From this it will determine the motor characteristics - encoder counts per cycle and the required commutation offset.  This is the first step in getting a brushless motor to work.
 
So it normally isn't necessary to wire the hall sensors unless you need to use them for some other reason.
 
Regards
TK

Group: DynoMotion Message: 3429 From: oxforduniv Date: 1/25/2012
Subject: Re: Halls for bldc feedback
Hall sensors for position would be pretty coarse resolution, in a 8 pole motor there is 4 electrical rotations per 1 mechanical!
Al.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Erik,
>  
> Hall sensors are sometimes used for brushless commutation not position feedback.  But the preferred method is to use the encoder position (with an index pulse) to do sinusoidal commutation.  This involves fewer IO bits, less wiring, and smoother commutation with less torque ripple. 
>  
> There is a C program to analyze your brushless motor characteristics automatically.  You only need to wire up the encoder and an index pulse and the 3 motor phases (to Out0, Out1, Out2 for side A of SnapAmp, or Out4, Out5, Out6 for side B).  The program is called AutoPhaseFind.c.  You will need to change some defines for your situation (which axis, which encoder, which index pulse input, which SnapAmp, etc...)  Running the program will rotate the motor like a stepper motor by energizing the various phases while watching the encoder and the index pulse.  From this it will determine the motor characteristics - encoder counts per cycle and the required commutation offset.  This is the first step in getting a brushless motor to work.
>  
> So it normally isn't necessary to wire the hall sensors unless you need to use them for some other reason.
>  
> Regards
> TK
>
> From: quelisto <quelisto@...>
> To: DynoMotion@yahoogroups.com
> Sent: Tuesday, January 24, 2012 9:14 PM
> Subject: [DynoMotion] Halls for bldc feedback
>
>
>  
> Tom: I presume it is possible to use Hall effect sensors for feedback. How can this be implemented in the software? The Halls on a motor I am using are TTL level signals, basically they are open collector with a pull-up resistor to 5V that I add on (for now they're 1.5 K).
>
> Thanks.
>
Group: DynoMotion Message: 3432 From: quelisto Date: 1/25/2012
Subject: Re: Halls for bldc feedback
Oh no doubt, Halls have terrible resolution. But, they are way cheaper than having to buy an encoder (they are essentially "free" as they come wth most BLDCs). If I'm only doing velocity control, I would think they'd be more than adequate for the job. I am primarily interested in making sure commutation phasing is correct.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Erik,
>  
> Hall sensors are sometimes used for brushless commutation not position feedback.  But the preferred method is to use the encoder position (with an index pulse) to do sinusoidal commutation.  This involves fewer IO bits, less wiring, and smoother commutation with less torque ripple. 
>  
> There is a C program to analyze your brushless motor characteristics automatically.  You only need to wire up the encoder and an index pulse and the 3 motor phases (to Out0, Out1, Out2 for side A of SnapAmp, or Out4, Out5, Out6 for side B).  The program is called AutoPhaseFind.c.  You will need to change some defines for your situation (which axis, which encoder, which index pulse input, which SnapAmp, etc...)  Running the program will rotate the motor like a stepper motor by energizing the various phases while watching the encoder and the index pulse.  From this it will determine the motor characteristics - encoder counts per cycle and the required commutation offset.  This is the first step in getting a brushless motor to work.
>  
> So it normally isn't necessary to wire the hall sensors unless you need to use them for some other reason.
>  
> Regards
> TK
>
> From: quelisto <quelisto@...>
> To: DynoMotion@yahoogroups.com
> Sent: Tuesday, January 24, 2012 9:14 PM
> Subject: [DynoMotion] Halls for bldc feedback
>
>
>  
> Tom: I presume it is possible to use Hall effect sensors for feedback. How can this be implemented in the software? The Halls on a motor I am using are TTL level signals, basically they are open collector with a pull-up resistor to 5V that I add on (for now they're 1.5 K).
>
> Thanks.
>
Group: DynoMotion Message: 3433 From: quelisto Date: 1/25/2012
Subject: Re: Halls for bldc feedback
You're absolutely right, but I'm not trying to control position, just velocity. I only need to make sure I'm commutating correctly.

--- In DynoMotion@yahoogroups.com, "oxforduniv" <oxforduniv@...> wrote:
>
> Hall sensors for position would be pretty coarse resolution, in a 8 pole motor there is 4 electrical rotations per 1 mechanical!
> Al.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Erik,
> >  
> > Hall sensors are sometimes used for brushless commutation not position feedback.  But the preferred method is to use the encoder position (with an index pulse) to do sinusoidal commutation.  This involves fewer IO bits, less wiring, and smoother commutation with less torque ripple. 
> >  
> > There is a C program to analyze your brushless motor characteristics automatically.  You only need to wire up the encoder and an index pulse and the 3 motor phases (to Out0, Out1, Out2 for side A of SnapAmp, or Out4, Out5, Out6 for side B).  The program is called AutoPhaseFind.c.  You will need to change some defines for your situation (which axis, which encoder, which index pulse input, which SnapAmp, etc...)  Running the program will rotate the motor like a stepper motor by energizing the various phases while watching the encoder and the index pulse.  From this it will determine the motor characteristics - encoder counts per cycle and the required commutation offset.  This is the first step in getting a brushless motor to work.
> >  
> > So it normally isn't necessary to wire the hall sensors unless you need to use them for some other reason.
> >  
> > Regards
> > TK
> >
> > From: quelisto <quelisto@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Tuesday, January 24, 2012 9:14 PM
> > Subject: [DynoMotion] Halls for bldc feedback
> >
> >
> >  
> > Tom: I presume it is possible to use Hall effect sensors for feedback. How can this be implemented in the software? The Halls on a motor I am using are TTL level signals, basically they are open collector with a pull-up resistor to 5V that I add on (for now they're 1.5 K).
> >
> > Thanks.
> >
>
Group: DynoMotion Message: 3434 From: Tom Kerekes Date: 1/25/2012
Subject: Re: Halls for bldc feedback
Hi Erik,
 
In that case, your 1.5K pull up should work.  There is no direct support for this you will need a User program to do the commutation.  See the example HallCommutate.c which should commutate the motor and spin it while applying an amplitude of "A" to the motor.  You will need to figure out the commutation sequence experimentally and put the values in the table.  If your 3phase brushless is connected to the "B" side of the SnapAmp then specify the OutputChan0 as 10.   You can also use the output of the table which is basically an angle to create the current position and save it into
 
ch1->Position
 
Set the Input Mode to "User Input".  You will need to handle the wraparound.  If you need help doing this let me know.
 
With the output mode set to "No Output" you can do the output yourself with the User Program by writing the Amplitude from ch1->Output.
 
Actually now that I think about it I don't see why it wouldn't work and commutate exactly like we were doing sinusoidal commutation right from an encoder.  But in this case we just have a really coarse encoder (6 counts per cycle).  So try setting invCountPerCycle=1/6.0 to see if that works..
 
 
Regarding your Stepper motor connected to SnapAmp Side A set the OutputMode as "Microstepper" and set OutputChan0=8 and OutputChan1=9.  For steppers the two coils us two independent full H bridges so the software allows independent settings.  For 3Phase drive 3 of the 4 half bridges are used together and must be all on one "side" so one OutputChan0 setting is sufficient.
 
 
For your 3rd Step/Dir Axis use OutputMode "Step Dir"  And OutputChan0=4 to use the 4th Step/Dir Generator coming out on JP5 pins 1 and 2 driven as open collector mode.
 
 
Hope this helps somewhat.
 
Regards
TK 
 
 
 
 

Group: DynoMotion Message: 3460 From: quelisto Date: 1/26/2012
Subject: Re: Halls for bldc feedback
Okay, it's starting to make more sense...but could you explain the channel numbering.

From the KMotionDe.h file I see that the output chan (in the CHAN struct) refers to PWM or DAC outputs. I see on the vlock diagram that there are separate PWM generators, as well as Step and Dir generators. So, are channels 0 through 7 the PWMs, channels 8 through 15 the step-n-dir generators, and higher channel #s the DAC outputs?


I also did not understand any of the last bit of your laast reponse:

"> For your 3rd Step/Dir Axis use OutputMode "Step Dir" And OutputChan0=4 to use the 4th Step/Dir Generator coming out on JP5 pins 1 and 2 driven as open collector mode."

Was this in reference to the BLDC, or is this for an additional motor (that I am not yet currently using).

Thanks

-Erik-


--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Erik,
>  
> In that case, your 1.5K pull up should work.  There is no direct support for this you will need a User program to do the commutation.  See the example HallCommutate.c which should commutate the motor and spin it while applying an amplitude of "A" to the motor.  You will need to figure out the commutation sequence experimentally and put the values in the table.  If your 3phase brushless is connected to the "B" side of the SnapAmp then specify the OutputChan0 as 10.   You can also use the output of the table which is basically an angle to create the current position and save it into
>  
> ch1->Position
>  
> Set the Input Mode to "User Input".  You will need to handle the wraparound.  If you need help doing this let me know.
>  
> With the output mode set to "No Output" you can do the output yourself with the User Program by writing the Amplitude from ch1->Output.
>  
> Actually now that I think about it I don't see why it wouldn't work and commutate exactly like we were doing sinusoidal commutation right from an encoder.  But in this case we just have a really coarse encoder (6 counts per cycle).  So try setting invCountPerCycle=1/6.0 to see if that works..
>  
>  
> Regarding your Stepper motor connected to SnapAmp Side A set the OutputMode as "Microstepper" and set OutputChan0=8 and OutputChan1=9.  For steppers the two coils us two independent full H bridges so the software allows independent settings.  For 3Phase drive 3 of the 4 half bridges are used together and must be all on one "side" so one OutputChan0 setting is sufficient.
>  
>  
> For your 3rd Step/Dir Axis use OutputMode "Step Dir"  And OutputChan0=4 to use the 4th Step/Dir Generator coming out on JP5 pins 1 and 2 driven as open collector mode.
>  
>  
> Hope this helps somewhat.
>  
> Regards
> TK 
>  
>  
>  
>  
>
>
> ________________________________
> From: quelisto <quelisto@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, January 25, 2012 10:42 AM
> Subject: [DynoMotion] Re: Halls for bldc feedback
>
>
>  
> Oh no doubt, Halls have terrible resolution. But, they are way cheaper than having to buy an encoder (they are essentially "free" as they come wth most BLDCs). If I'm only doing velocity control, I would think they'd be more than adequate for the job. I am primarily interested in making sure commutation phasing is correct.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Erik,
> >  
> > Hall sensors are sometimes used for brushless commutation not position feedback.  But the preferred method is to use the encoder position (with an index pulse) to do sinusoidal commutation.  This involves fewer IO bits, less wiring, and smoother commutation with less torque ripple. 
> >  
> > There is a C program to analyze your brushless motor characteristics automatically.  You only need to wire up the encoder and an index pulse and the 3 motor phases (to Out0, Out1, Out2 for side A of SnapAmp, or Out4, Out5, Out6 for side B).  The program is called AutoPhaseFind.c.  You will need to change some defines for your situation (which axis, which encoder, which index pulse input, which SnapAmp, etc...)  Running the program will rotate the motor like a stepper motor by energizing the various phases while watching the encoder and the index pulse.  From this it will determine the motor characteristics - encoder counts per cycle and the required commutation offset.  This is the first step in getting a brushless motor to work.
> >  
> > So it normally isn't necessary to wire the hall sensors unless you need to use them for some other reason.
> >  
> > Regards
> > TK
> >
> > From: quelisto <quelisto@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Tuesday, January 24, 2012 9:14 PM
> > Subject: [DynoMotion] Halls for bldc feedback
> >
> >
> >  
> > Tom: I presume it is possible to use Hall effect sensors for feedback. How can this be implemented in the software? The Halls on a motor I am using are TTL level signals, basically they are open collector with a pull-up resistor to 5V that I add on (for now they're 1.5 K).
> >
> > Thanks.
> >
>
Group: DynoMotion Message: 3463 From: Tom Kerekes Date: 1/26/2012
Subject: Re: Halls for bldc feedback
Hi Erik,
 
It may help for you to replace in your mind the term "channel" with "number" or "selector" or eliminate it entirely.  A channel is not a "thing".  There are Axes, Input Devices (encoders, ADC's, ...), Output Devices (PWMs, Step/Dir Generators, DACs, ...). 
 
So no, you do not use the OutputChan0 number to select the type of device.  Selecting the Output Mode as "Step Dir", or "DAC Servo", or "3PH Servo" inherently selects the type of output device or (two output devices that will be used).  The OutputChan0 selects which one (and in the cases where two are required then OutputChan1 will specify the other).
 
Also note that the PWMs shown in the functional diagram of KFLOP are different than the ones inside SnapAmp.  The PWMs in KFLOP are simple 8-bit PWMS that output a 3.3V LVTTL pulses that are not currently selectable as Axis Output Devices.  You can only access those from User Programs.
 
That statement was referring to your 3rd motor.
 
Regards
TK

Group: DynoMotion Message: 3475 From: quelisto Date: 1/26/2012
Subject: Re: Halls for bldc feedback
Okay, now we're getting somewhere. I follow conceptually what you are saying about an axis, and input device,and an output device. Is there a table somewhere that explains what the Chan#->outputchanX should be for StepDir, DACServo, and 3PHServo, given the options of Kanalog, Snapamp, etc?

I now understand that outputchan0 and outputchan1 are just designators, but is there a way to understand what it is selecting?

For example, to use the first axis of the snap amp with a stepper, we use outputchan 8 and 9. I presume this forces 2 or more signals to travel through JP4 to the snap amp. However, if I want to use Axis 0 (1st axis) of the Kflop board itself for a stepper, the step/dir output is routed to IO outputs 8 and 9 (which correspond to physical pins 15 & 16 of JP7)and this output is selected (if I recall correctly) by outputchan0 = 10, outputchan1 = don't care. This has got me pretty confused as it seems these selectors have a context (to the options selcted for SnapAmp, etc.), they are not absolute.

So, a table explaining all of this would be really nice :)

-Erik-




Could you ex

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Erik,
>  
> It may help for you to replace in your mind the term "channel" with "number" or "selector" or eliminate it entirely.  A channel is not a "thing".  There are Axes, Input Devices (encoders, ADC's, ...), Output Devices (PWMs, Step/Dir Generators, DACs, ...). 
>  
> So no, you do not use the OutputChan0 number to select the type of device.  Selecting the Output Mode as "Step Dir", or "DAC Servo", or "3PH Servo" inherently selects the type of output device or (two output devices that will be used).  The OutputChan0 selects which one (and in the cases where two are required then OutputChan1 will specify the other).
>  
> Also note that the PWMs shown in the functional diagram of KFLOP are different than the ones inside SnapAmp.  The PWMs in KFLOP are simple 8-bit PWMS that output a 3.3V LVTTL pulses that are not currently selectable as Axis Output Devices.  You can only access those from User Programs.
>  
> That statement was referring to your 3rd motor.
>  
> Regards
> TK
>
> From: quelisto <quelisto@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, January 26, 2012 10:22 AM
> Subject: [DynoMotion] Re: Halls for bldc feedback
>
>
>  
> Okay, it's starting to make more sense...but could you explain the channel numbering.
>
> From the KMotionDe.h file I see that the output chan (in the CHAN struct) refers to PWM or DAC outputs. I see on the vlock diagram that there are separate PWM generators, as well as Step and Dir generators. So, are channels 0 through 7 the PWMs, channels 8 through 15 the step-n-dir generators, and higher channel #s the DAC outputs?
>
> I also did not understand any of the last bit of your laast reponse:
>
> "> For your 3rd Step/Dir Axis use OutputMode "Step Dir" And OutputChan0=4 to use the 4th Step/Dir Generator coming out on JP5 pins 1 and 2 driven as open collector mode."
>
> Was this in reference to the BLDC, or is this for an additional motor (that I am not yet currently using).
>
> Thanks
>
> -Erik-
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Erik,
> >  
> > In that case, your 1.5K pull up should work.  There is no direct support for this you will need a User program to do the commutation.  See the example HallCommutate.c which should commutate the motor and spin it while applying an amplitude of "A" to the motor.  You will need to figure out the commutation sequence experimentally and put the values in the table.  If your 3phase brushless is connected to the "B" side of the SnapAmp then specify the OutputChan0 as 10.   You can also use the output of the table which is basically an angle to create the current position and save it into
> >  
> > ch1->Position
> >  
> > Set the Input Mode to "User Input".  You will need to handle the wraparound.  If you need help doing this let me know.
> >  
> > With the output mode set to "No Output" you can do the output yourself with the User Program by writing the Amplitude from ch1->Output.
> >  
> > Actually now that I think about it I don't see why it wouldn't work and commutate exactly like we were doing sinusoidal commutation right from an encoder.  But in this case we just have a really coarse encoder (6 counts per cycle).  So try setting invCountPerCycle=1/6.0 to see if that works..
> >  
> >  
> > Regarding your Stepper motor connected to SnapAmp Side A set the OutputMode as "Microstepper" and set OutputChan0=8 and OutputChan1=9.  For steppers the two coils us two independent full H bridges so the software allows independent settings.  For 3Phase drive 3 of the 4 half bridges are used together and must be all on one "side" so one OutputChan0 setting is sufficient.
> >  
> >  
> > For your 3rd Step/Dir Axis use OutputMode "Step Dir"  And OutputChan0=4 to use the 4th Step/Dir Generator coming out on JP5 pins 1 and 2 driven as open collector mode.
> >  
> >  
> > Hope this helps somewhat.
> >  
> > Regards
> > TK 
> >  
> >  
> >  
> >  
> >
> >
> > ________________________________
> > From: quelisto <quelisto@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Wednesday, January 25, 2012 10:42 AM
> > Subject: [DynoMotion] Re: Halls for bldc feedback
> >
> >
> >  
> > Oh no doubt, Halls have terrible resolution. But, they are way cheaper than having to buy an encoder (they are essentially "free" as they come wth most BLDCs). If I'm only doing velocity control, I would think they'd be more than adequate for the job. I am primarily interested in making sure commutation phasing is correct.
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Erik,
> > >  
> > > Hall sensors are sometimes used for brushless commutation not position feedback.  But the preferred method is to use the encoder position (with an index pulse) to do sinusoidal commutation.  This involves fewer IO bits, less wiring, and smoother commutation with less torque ripple. 
> > >  
> > > There is a C program to analyze your brushless motor characteristics automatically.  You only need to wire up the encoder and an index pulse and the 3 motor phases (to Out0, Out1, Out2 for side A of SnapAmp, or Out4, Out5, Out6 for side B).  The program is called AutoPhaseFind.c.  You will need to change some defines for your situation (which axis, which encoder, which index pulse input, which SnapAmp, etc...)  Running the program will rotate the motor like a stepper motor by energizing the various phases while watching the encoder and the index pulse.  From this it will determine the motor characteristics - encoder counts per cycle and the required commutation offset.  This is the first step in getting a brushless motor to work.
> > >  
> > > So it normally isn't necessary to wire the hall sensors unless you need to use them for some other reason.
> > >  
> > > Regards
> > > TK
> > >
> > > From: quelisto <quelisto@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Tuesday, January 24, 2012 9:14 PM
> > > Subject: [DynoMotion] Halls for bldc feedback
> > >
> > >
> > >  
> > > Tom: I presume it is possible to use Hall effect sensors for feedback. How can this be implemented in the software? The Halls on a motor I am using are TTL level signals, basically they are open collector with a pull-up resistor to 5V that I add on (for now they're 1.5 K).
> > >
> > > Thanks.
> > >
> >
>